package portal.conf.entity;

import portal.common.MyStringUtils;

public class EtcHostsEntity extends BaseConf {
	String name="";
	String ip="";
	String dName="";
	public EtcHostsEntity(){}
	public EtcHostsEntity(String name,String ip,String dName){
		this.name=name;
		this.ip=ip;
		this.dName=dName;
	}
	public EtcHostsEntity setValue(String  val){
		val= MyStringUtils.strictSpace(val);
		String[]data=val.split(" ");
		if(data.length>=2){
			//System.out.println(val);
			dName=data[1];
			if(data.length>=3)
				name= data[2];
			else {
				name =data[1];
			}
			ip =	data[0];
			dName=data[1];
		}

	/*	System.out.println("----------------------------------------");
		System.out.println(this.name);
		System.out.println(this.ip);
		System.out.println(this.dName);*/
		return this;
	}
	public String getName(){
		if(name==null)
			return "";
		return name;
	}
	@Override
	public String toString(){
		return ip+" "+dName+" "+name;
	}
	@Override
	public String getKey() {
		return getName();
	}
	public String getIp() {
		return ip;
	}
	public String getdName() {
		return dName;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setIp(String ip) {
		this.ip = ip;
	}
	public void setdName(String dName) {
		this.dName = dName;
	}
	
}
